package com.nix.boxing;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class P10 extends Activity {
	private ImageView imgView;
	private AnimationDrawable mAnimation; 
	private Handler mHandler = new Handler();
	private static final long START_DELAY = 500;
	private Runnable mRunnable = new Runnable() {
		public void run() {
			startAnimation(mAnimation);
			}
		};
		
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.p10);
        
        imgView=(ImageView)this.findViewById(R.id.icon10);
        mAnimation = (AnimationDrawable) imgView.getBackground();
        
        Button btn_prev = (Button)findViewById(R.id.btn_pre10_9);
        btn_prev.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent();
				intent.setClass(P10.this, P9.class);
				startActivity(intent);
				//ArrestBoxing.this.finish();
			}
		});
        
        Button btn_next = (Button)findViewById(R.id.btn_next10_11);
        btn_next.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent();
				intent.setClass(P10.this, P11.class);
				startActivity(intent);
				//ArrestBoxing.this.finish();
			}
		});
	}
	
	protected void onPause(){
		super.onPause();
	}
	
	protected void onResume(){
		super.onResume();
		mHandler.postDelayed(mRunnable, START_DELAY);
	}
	
	protected void startAnimation(final AnimationDrawable animation) {
		if (animation != null && !animation.isRunning()) {
			animation.run();
			}       
	}             
	protected void stopAnimation(final AnimationDrawable animation) {
		if (animation != null && animation.isRunning()) animation.stop();
	}   
}
